package org.sippr.pojo;

import jakarta.validation.constraints.NotEmpty;
import lombok.Data;

import java.io.Serializable;

/**
 * 需要实时的判断算力机状态，并更新缓存。算力机ip等信息存储在数据库，但是状态存储在缓存。
 * server
 */
@Data
public class Server implements Serializable {
    private Integer id;

    @NotEmpty
    private String name;
    @NotEmpty
    private String address;
    //1在线，2无法访问，
    private Short state;
    private String stateStr;

    public String getStateStr() {
        String str = switch (state) {
            case 1 -> "在线";
            default -> "无法访问";
        };
        return str;
    }

    private static final long serialVersionUID = 1L;
}